﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="4-5.aspx.cs" Inherits="项目4._4_5" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="id" DataSourceID="SqlDataSource1" 
            onrowdatabound="GridView1_RowDataBound"  >
            <Columns>
                <asp:BoundField DataField="id" HeaderText="编号" ReadOnly="True" 
                    SortExpression="id" />
                <asp:BoundField DataField="title" HeaderText="新闻标题" SortExpression="title" />
                <asp:BoundField DataField="createTime" HeaderText="发布时间" 
                    SortExpression="createTime" />
                <asp:BoundField DataField="caId" HeaderText="新闻类别" SortExpression="caId" />
                <asp:TemplateField HeaderText="已发布天数">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:systemConnectionString %>" 
            SelectCommand="SELECT [id], [title], [createTime], [caId] FROM [news]">
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
